package day8;
//实现Runnable接口 实现run()
public class TestRunnable implements Runnable{
    //线程的执行逻辑
    public void run() {
        String name= Thread.currentThread().getName();
        for(int i=0;i<10;i++){
            System.out.println(name+" "+i);
        }
    }
    public static void main(String[] args) {
        //不是线程对象(根Thread没关系) 只是线程执行规则
        TestRunnable test=new TestRunnable();
        //t1t2才是线程对象
        Thread t1=new Thread(test,"A");
        Thread t2=new Thread(test,"B");
        Thread t3=new Thread(()->{
            String name=Thread.currentThread().getName();
            for(int i=10;i<20;i++){
                System.out.println(name+" "+i);
            }
        },"C");

        t1.start();
        t2.start();
        t3.start();
    }
}
